package com.exigen.performance.test.webapp.dto;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;

import net.sf.jasperreports.engine.JRExporterParameter;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.export.JRPdfExporter;
import net.sf.jasperreports.engine.export.JRXlsAbstractExporterParameter;
import net.sf.jasperreports.engine.export.JRXlsExporter;
import net.sf.jasperreports.engine.export.ooxml.JRDocxExporter;

import org.primefaces.event.CloseEvent;
import org.primefaces.event.DateSelectEvent;
import org.primefaces.model.DefaultStreamedContent;
import org.primefaces.model.StreamedContent;

import com.exigen.performance.test.webapp.domain.ProjectEntity;
import com.exigen.performance.test.webapp.domain.ReportEntity;
import com.exigen.performance.test.webapp.domain.RequestTemplateEntity;
import com.exigen.performance.test.webapp.domain.ScenarioEntity;
import com.exigen.performance.test.webapp.domain.ScenarioTypeEntity;
import com.exigen.performance.test.webapp.domain.TestSummaryEntity;
import com.exigen.performance.test.webapp.domain.TransactionEntity;
import com.exigen.performance.test.webapp.services.ReportServices;

/**
 * Class backing report generation page.
 * 
 * @author Maksim Savcuk
 * 
 */
@ManagedBean
@ViewScoped
public class ReportGenerationDto {

	private Integer rowNumber;

	// Fields that contain data selected from UI
	private ProjectEntity selectedProject;
	private ScenarioEntity selectedScenario;
	private ScenarioTypeEntity[] selectedScenarioType;
	private String[] selectedBranchID;
	private String[] selectedBuildID;
	private String[] selectedState;
	private TransactionEntity[] selectedTransaction;
	private TestSummaryEntity[] selectedTestSummary;

	// Fields that contain data
	// Full project list;
	private List<ProjectEntity> projects;
	// Filtered project list;
	private List<ProjectEntity> filteredProjectList;

	// Full available scenario list;
	private List<ScenarioEntity> scenarios;
	// Filtered scenario list;
	private List<ScenarioEntity> filteredScenarioList;

	// Full available scenario type list;
	private List<ScenarioTypeEntity> scenarioTypes;
	// Filtered scenario type list;
	private List<ScenarioTypeEntity> filteredScenarioTypeList;

	// Full available branch id list;
	private List<String> branchId;
	// Filtered branch id list;
	private List<String> filteredBranchId;

	// Full available build number list;
	private List<String> buildId;
	// Filtered build number list
	private List<String> filteredBuildId;

	// Full available state list;
	private List<String> state;
	// Filtered state list;
	private List<String> filteredState;

	private List<TestSummaryEntity> testSummaries;

	// Full available transaction list;
	private List<TransactionEntity> transactions;
	// Filtered transactions;
	private List<TransactionEntity> filteredTransactions;

	// Time interval;
	private Date fromDate;
	private Date untilDate = new Date();

	// Service class;
	ReportServices reportServices;

	// Field for storing report information;
	private ReportEntity reportEntity = new ReportEntity();

	// Fields for defining report type;
	private List<String> reportType;
	private String selectedReportType;
	// Field for defining report sub-type;
	private List<String> reportSubType;
	private String selectedReportSubType;

	// Field for defining report format;
	private List<String> reportFormat;
	private String selectedReportFormat;

	// Field to store generated report for upload;
	private StreamedContent report;

	// Template name
	private String templateName;

	public ReportGenerationDto() {
		Calendar c = Calendar.getInstance();
		c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
		fromDate = c.getTime();
		reportFormat = new ArrayList<String>();
		reportFormat.add("PDF");
		reportFormat.add("XLS");
		reportFormat.add("DOCX");

	}

	/**
	 * Method used to change report type available for select depending on
	 * selected project.
	 */
	public void fillReportType() {
		reportType = new ArrayList<String>();
		if (reportEntity.getProject().getHasIntermediate() == 1) {
			reportType.add("Intermediate");
			reportType.add("Historical");
		} else {
			reportType.add("Historical");
		}
	}

	/**
	 * Method that changes sub-type select contents depending on selected report
	 * type;
	 */
	public void handleReportTypeChange() {
		if (selectedReportType != null) {
			if (selectedReportType.equals("Intermediate")) {
				reportSubType = new ArrayList<String>();
				reportSubType.add("Response time");
				reportSubType.add("Response size");
				reportSubType.add("Hits");
				reportSubType.add("Troughput");

			} else {
				reportSubType = new ArrayList<String>();
				reportSubType.add("90%");
				reportSubType.add("Average");

			}
		} else {
			reportSubType = null;
		}
	}

	/**
	 * Method that validates all collected report data and saves generated
	 * report as Input Stream in "report" field for future use.
	 * 
	 * @param event
	 */
	public void generateReport(ActionEvent event) {
		report = null; // Old report deleted;
		reportEntity.setStartDate(fromDate);
		reportEntity.setEndDate(untilDate);
		// Data validation
		if (reportEntity.getProject() == null
				|| reportEntity.getScenario() == null
				|| reportEntity.getScenarioType() == null
				|| reportEntity.getBranchId() == null
				|| reportEntity.getBuild() == null
				|| reportEntity.getState() == null
				|| reportEntity.getStartDate() == null
				|| reportEntity.getEndDate() == null
				|| reportEntity.getTestSummaries() == null
				|| reportEntity.getTransactions() == null
				|| selectedReportType == null || selectedReportSubType == null) {
			FacesContext.getCurrentInstance().addMessage(
					null,
					new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error!",
							"Required data not selected!"));
		} else {
			// If validated successfully
			boolean validType = false;
			// Check report type;
			if (selectedReportType.equals("Intermediate")) {
				reportEntity.setIntermediate(true);
				if (selectedReportSubType.equals("Troughput")) {
					reportEntity.setType(2);
					validType = true;
				}
				if (selectedReportSubType.equals("Response time")) {
					reportEntity.setType(1);
					validType = true;
				}
				if (selectedReportSubType.equals("Response size")) {
					reportEntity.setType(3);
					validType = true;
				}
				if (selectedReportSubType.equals("Hits")) {
					reportEntity.setType(4);
					validType = true;
				}

			} else {
				reportEntity.setIntermediate(false);
				if (selectedReportSubType.equals("90%")) {
					reportEntity.setType(0);
					validType = true;
				} else {
					reportEntity.setType(1);
					validType = true;
				}
			}
			if (validType) {
				if (selectedReportFormat.equals("PDF")
						|| selectedReportFormat.equals("XLS")
						|| selectedReportFormat.equals("DOCX")) {
					JasperPrint jasperPrint;
					try {
						// Passes report for report fill;
						jasperPrint = reportServices
								.generateReport(reportEntity);
						// Converts filled report in correct(currently pdf only)
						// format
						// for future download;
						if (selectedReportFormat.equals("PDF")) {
							JRPdfExporter exporter = new JRPdfExporter();
							exporter.setParameter(
									JRExporterParameter.JASPER_PRINT,
									jasperPrint);
							ByteArrayOutputStream baos = new ByteArrayOutputStream();
							exporter.setParameter(
									JRExporterParameter.OUTPUT_STREAM, baos);
							exporter.exportReport();

							// Converting OutputStream to InputStream;
							InputStream bais = new ByteArrayInputStream(
									((ByteArrayOutputStream) baos)
											.toByteArray());

							report = new DefaultStreamedContent(bais,
									"application/pdf", reportEntity
											.getProject().getProjectName()
											+ "-"
											+ reportEntity.getScenario()
													.getScenarioName()
											+ "-report.pdf");
						}
						if (selectedReportFormat.equals("XLS")) {
							JRXlsExporter exporter = new JRXlsExporter();
							exporter.setParameter(
									JRXlsAbstractExporterParameter.JASPER_PRINT,
									jasperPrint);
							ByteArrayOutputStream baos = new ByteArrayOutputStream();
							exporter.setParameter(
									JRXlsAbstractExporterParameter.OUTPUT_STREAM,
									baos);
							exporter.setParameter(
									JRXlsAbstractExporterParameter.IS_DETECT_CELL_TYPE,
									true);
							exporter.setParameter(
									JRXlsAbstractExporterParameter.IS_ONE_PAGE_PER_SHEET,
									false);
							exporter.setParameter(
									JRXlsAbstractExporterParameter.IS_WHITE_PAGE_BACKGROUND,
									true);
							exporter.setParameter(
									JRXlsAbstractExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,
									true);

							exporter.exportReport();

							// Converting OutputStream to InputStream;
							InputStream bais = new ByteArrayInputStream(
									((ByteArrayOutputStream) baos)
											.toByteArray());

							report = new DefaultStreamedContent(bais,
									"text/xls", reportEntity.getProject()
											.getProjectName()
											+ "-"
											+ reportEntity.getScenario()
													.getScenarioName()
											+ "-report.xls");
						}
						if (selectedReportFormat.equals("DOCX")) {
							JRDocxExporter exporter = new JRDocxExporter();
							exporter.setParameter(
									JRExporterParameter.JASPER_PRINT,
									jasperPrint);
							ByteArrayOutputStream baos = new ByteArrayOutputStream();
							exporter.setParameter(
									JRExporterParameter.OUTPUT_STREAM, baos);
							exporter.exportReport();

							// Converting OutputStream to InputStream;
							InputStream bais = new ByteArrayInputStream(
									((ByteArrayOutputStream) baos)
											.toByteArray());

							report = new DefaultStreamedContent(bais,
									"text/docx", reportEntity.getProject()
											.getProjectName()
											+ "-"
											+ reportEntity.getScenario()
													.getScenarioName()
											+ "-report.docx");

						}

					} catch (Exception e) {

						FacesContext.getCurrentInstance().addMessage(
								null,
								new FacesMessage(FacesMessage.SEVERITY_ERROR,
										"Error during report generation!", e
												.getMessage()));
					}
				} else {
					FacesContext.getCurrentInstance().addMessage(
							null,
							new FacesMessage(FacesMessage.SEVERITY_ERROR,
									"Error!", "Format not selected!"));
				}
			} else {
				FacesContext.getCurrentInstance().addMessage(
						null,
						new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error!",
								"Unable to recognize report type!"));
			}
		}

	}

	/**
	 * Method for saving selected report data as template;
	 * 
	 * @param event
	 */
	public void saveReportTemplate(ActionEvent event) {
		if (reportEntity.getTransactions().isEmpty()
				|| reportEntity.getTransactions() == null) {
			FacesContext.getCurrentInstance().addMessage(
					null,
					new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error!",
							"No transactions selected!"));
		} else {
			if (reportEntity.isIntermediate()) {
				FacesContext.getCurrentInstance().addMessage(
						null,
						new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error!",
								"You can save only historical reports!"));
			} else {
				if (templateName.length() > 2 && templateName.length() < 30) {
					RequestTemplateEntity template = new RequestTemplateEntity();
					template.setTemplateName(templateName);
					template.setTestSummaries(reportEntity.getTestSummaries());
					template.setTransactions(reportEntity.getTransactions());
					try {
						reportServices.createNewTemplate(template);
						FacesContext.getCurrentInstance().addMessage(
								null,
								new FacesMessage(FacesMessage.SEVERITY_INFO,
										"Success!", "Template was saved!"));
					} catch (Exception e) {
						FacesContext.getCurrentInstance().addMessage(
								null,
								new FacesMessage(FacesMessage.SEVERITY_ERROR,
										"Error!", e.getMessage()));
					}
				} else {
					FacesContext.getCurrentInstance().addMessage(
							null,
							new FacesMessage(FacesMessage.SEVERITY_ERROR,
									"Error!", "Wrong name!"));
				}
			}
		}
	}

	/**
	 * Method that deletes all selected data;
	 * 
	 * @param event
	 */
	public void cleanForm(ActionEvent event) {
		reportEntity = new ReportEntity();
		projects = null;
		scenarios = null;
		scenarioTypes = null;
		branchId = null;
		buildId = null;
		state = null;
		fromDate = null;
		untilDate = null;
		reportType = null;
		selectedReportType = null;
		reportSubType = null;
		selectedReportSubType = null;
		testSummaries = null;

		this.transactions = null;

	}

	/**
	 * Method that should be called after selecting new project to remove all
	 * data associated with old selected project and save new selected data in
	 * report entity;
	 * 
	 */
	public void selectNewProject() {

		this.scenarioTypes = null;
		this.branchId = null;
		this.buildId = null;
		this.state = null;
		this.testSummaries = null;
		this.transactions = null;
		reportEntity.setScenario(null);
		reportEntity.setScenarioType(null);
		reportEntity.setBranchId(null);
		reportEntity.setBuild(null);
		reportEntity.setState(null);
		reportEntity.setProject(selectedProject);
		reportEntity.setTestSummaries(null);
		reportEntity.setTransactions(null);
		selectedReportSubType = null;
		reportSubType = null;
		fillReportType();
	}

	/**
	 * Method that should be called after selecting new scenario to remove all
	 * data associated with old selected scenario and save new selected data in
	 * report entity;
	 * 
	 */
	public void selectNewScenario() {
		reportEntity.setScenarioType(null);
		this.scenarioTypes = null;
		this.branchId = null;
		this.buildId = null;
		this.state = null;
		this.testSummaries = null;
		this.transactions = null;
		reportEntity.setScenarioType(null);
		reportEntity.setBranchId(null);
		reportEntity.setBuild(null);
		reportEntity.setState(null);
		reportEntity.setTestSummaries(null);
		reportEntity.setTransactions(null);
		reportEntity.setScenario(selectedScenario);
	}

	/**
	 * Method that should be called after selecting new scenario type remove all
	 * data associated with old selected scenario type and save new selected
	 * data in report entity;
	 * 
	 * @param event
	 */
	public void selectNewScenarioTypes(CloseEvent event) {
		this.branchId = null;
		this.buildId = null;
		this.state = null;
		this.testSummaries = null;
		this.transactions = null;
		reportEntity.setBranchId(null);
		reportEntity.setBuild(null);
		reportEntity.setState(null);
		reportEntity.setTestSummaries(null);
		reportEntity.setTransactions(null);
		reportEntity.setScenarioType(selectedScenarioType);
	}

	/**
	 * Method that should be called after selecting new branch id to remove all
	 * data associated with old selected branch id and save new selected data in
	 * report entity;
	 * 
	 * @param event
	 */
	public void selectNewBranchId(CloseEvent event) {
		this.buildId = null;
		this.state = null;
		this.testSummaries = null;
		this.transactions = null;
		reportEntity.setBuild(null);
		reportEntity.setState(null);
		reportEntity.setTestSummaries(null);
		reportEntity.setTransactions(null);
		List<String> branchId = new ArrayList<String>();
		for (String b : selectedBranchID) {
			branchId.add(b);
		}
		reportEntity.setBranchId(branchId);
	}

	/**
	 * Method that should be called after selecting new build number to remove
	 * all data associated with old selected build number and save new selected
	 * data in report entity;
	 * 
	 * @param event
	 */
	public void selectNewBuildId(CloseEvent event) {
		this.state = null;
		this.testSummaries = null;
		this.transactions = null;
		reportEntity.setState(null);
		reportEntity.setTestSummaries(null);
		reportEntity.setTransactions(null);
		List<String> buildId = new ArrayList<String>();
		for (String b : selectedBuildID) {
			buildId.add(b);
		}
		reportEntity.setBuild(buildId);
	}

	/**
	 * Method that save selected state in report entity;
	 * 
	 * @param event
	 */
	public void selectNewState(CloseEvent event) {
		this.transactions = null;
		this.testSummaries = null;
		reportEntity.setTransactions(null);
		reportEntity.setTestSummaries(null);
		List<String> states = new ArrayList<String>();
		for (String b : selectedState) {
			states.add(b);
		}
		reportEntity.setState(states);
	}

	/**
	 * Method that save selected test summary in report entity;
	 * 
	 * @param event
	 */
	public void selectNewTestSummary(CloseEvent event) {
		this.transactions = null;
		reportEntity.setTransactions(null);
		List<TestSummaryEntity> summaries = new ArrayList<TestSummaryEntity>();
		for (TestSummaryEntity b : this.selectedTestSummary) {
			summaries.add(b);
		}
		reportEntity.setTestSummaries(summaries);
	}

	/**
	 * Method that save selected transactions
	 * 
	 * @param event
	 */
	public void selectNewTransaction(CloseEvent event) {
		List<TransactionEntity> transactions = new ArrayList<TransactionEntity>();
		for (TransactionEntity t : selectedTransaction) {
			transactions.add(t);
		}
		reportEntity.setTransactions(transactions);

	}

	/**
	 * Method that gets list of all available projects from database;
	 * 
	 * @param actionEvent
	 */
	public void getProjectList(ActionEvent actionEvent) {
		if (rowNumber == null) {
			try {
				String confValue = reportServices
						.getConfiguration("ROW_NUMBER");
				rowNumber = Integer.parseInt(confValue);
			} catch (Exception e) {
				rowNumber = 5;
			}
		}
		try {
			projects = reportServices.getProjectList();
		} catch (Exception e) {
			FacesContext.getCurrentInstance().addMessage(
					null,
					new FacesMessage(FacesMessage.SEVERITY_ERROR,
							"Exception occured!", e.getMessage()));
		}
	}

	/**
	 * Method that gets list of all available scenarios from database by
	 * selected project;
	 * 
	 * @param actionEvent
	 */
	public void getScenarioListByProject(ActionEvent actionEvent) {
		if (reportEntity.getProject() != null) {
			try {
				scenarios = reportServices.getScenariosByProject(reportEntity
						.getProject().getId());
			} catch (Exception e) {
				FacesContext.getCurrentInstance().addMessage(
						null,
						new FacesMessage(FacesMessage.SEVERITY_ERROR,
								"Exception occured!", e.getMessage()));
			}
		}
	}

	/**
	 * Method that gets list of all available scenario types from database by
	 * selected project and scenario;
	 * 
	 * @param actionEvent
	 */
	public void getScenarioTypeList(ActionEvent actionEvent) {
		if (reportEntity.getProject() != null
				&& reportEntity.getScenario() != null)
			try {
				scenarioTypes = reportServices.getScenarioType(reportEntity
						.getProject().getId(), reportEntity.getScenario()
						.getId());
			} catch (Exception e) {
				FacesContext.getCurrentInstance().addMessage(
						null,
						new FacesMessage(FacesMessage.SEVERITY_ERROR,
								"Exception occured!", e.getMessage()));
			}
	}

	/**
	 * Method that gets list of all available branch id from database by
	 * selected project, scenario and scenario types;
	 * 
	 * @param actionEvent
	 */
	public void getBranchIdList(ActionEvent actionEvent) {
		if (reportEntity.getProject() != null
				&& reportEntity.getScenario() != null
				&& reportEntity.getScenarioType() != null) {
			try {
				List<Long> scenarioTypeId = new ArrayList<Long>();
				for (ScenarioTypeEntity e : reportEntity.getScenarioType()) {
					scenarioTypeId.add(e.getId());
				}

				this.branchId = reportServices.getBranchIdList(reportEntity
						.getProject().getId(), reportEntity.getScenario()
						.getId(), scenarioTypeId);
			} catch (Exception e) {
				FacesContext.getCurrentInstance().addMessage(
						null,
						new FacesMessage(FacesMessage.SEVERITY_ERROR,
								"Exception occured!", e.getMessage()));
			}

		}
	}

	/**
	 * Method that gets list of all available build numbers from database by
	 * selected project, scenario, scenario types and branch id;
	 * 
	 * @param actionEvent
	 */
	public void getBuildIdList(ActionEvent actionEvent) {
		if (reportEntity.getProject() != null
				&& reportEntity.getScenario() != null
				&& reportEntity.getScenarioType() != null
				&& reportEntity.getBranchId() != null) {
			try {
				List<Long> scenarioTypeId = new ArrayList<Long>();
				for (ScenarioTypeEntity e : reportEntity.getScenarioType()) {
					scenarioTypeId.add(e.getId());
				}

				this.buildId = reportServices.getBuildIdList(reportEntity
						.getProject().getId(), reportEntity.getScenario()
						.getId(), scenarioTypeId, reportEntity.getBranchId());
			} catch (Exception e) {
				FacesContext.getCurrentInstance().addMessage(
						null,
						new FacesMessage(FacesMessage.SEVERITY_ERROR,
								"Exception occured!", e.getMessage()));
			}
		}
	}

	/**
	 * Method that gets list of all available states from database by selected
	 * project, scenario, scenario types, branch id and build numbers;
	 * 
	 * @param actionEvent
	 */
	public void getStateList(ActionEvent actionEvent) {
		if (reportEntity.getProject() != null
				&& reportEntity.getScenario() != null
				&& reportEntity.getScenarioType() != null
				&& reportEntity.getBranchId() != null
				&& reportEntity.getBuild() != null) {
			try {
				List<Long> scenarioTypeId = new ArrayList<Long>();
				for (ScenarioTypeEntity e : reportEntity.getScenarioType()) {
					scenarioTypeId.add(e.getId());
				}

				this.state = reportServices.getStateList(reportEntity
						.getProject().getId(), reportEntity.getScenario()
						.getId(), scenarioTypeId, reportEntity.getBranchId(),
						reportEntity.getBuild());
			} catch (Exception e) {
				FacesContext.getCurrentInstance().addMessage(
						null,
						new FacesMessage(FacesMessage.SEVERITY_ERROR,
								"Exception occured!", e.getMessage()));
			}
		}
	}

	/**
	 * Method that will collect all available test summaries.
	 * 
	 * @param event
	 */
	public void getTestSummaryList(ActionEvent event) {
		reportEntity.setStartDate(fromDate);
		reportEntity.setEndDate(untilDate);
		if (!(reportEntity.getProject() == null
				|| reportEntity.getScenario() == null
				|| reportEntity.getScenarioType() == null
				|| reportEntity.getBranchId() == null
				|| reportEntity.getBuild() == null || reportEntity.getState() == null)) {
			testSummaries = reportServices
					.getTestSummaryByReportEntity(reportEntity);
		}
	}

	/**
	 * Method that gets list of all available transactions from database by
	 * selected project, scenario, scenario types, branch id, build numbers and
	 * states;
	 * 
	 * @param actionEvent
	 */
	public void getTransactionList(ActionEvent actionEvent) {
		reportEntity.setStartDate(fromDate);
		reportEntity.setEndDate(untilDate);
		if (!(reportEntity.getProject() == null
				|| reportEntity.getScenario() == null
				|| reportEntity.getScenarioType() == null
				|| reportEntity.getBranchId() == null
				|| reportEntity.getBuild() == null
				|| reportEntity.getState() == null || reportEntity
					.getTestSummaries() == null)) {
			transactions = reportServices.getTransactionList(reportEntity);
		}
	}

	/**
	 * Saves selected from date and checks if it is smaller than until date;
	 * 
	 * @param event
	 */
	public void selectFromDate(DateSelectEvent event) {
		fromDate = event.getDate();
		if (untilDate != null) {
			if (fromDate.after(untilDate)) {
				fromDate = null;
				FacesContext.getCurrentInstance().addMessage(
						null,
						new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error!",
								"Beginning date bigger that end date!"));
			}
		}
	}

	/**
	 * Saves selected until date and check if it is bigger than from date;
	 * 
	 * @param event
	 */
	public void selectUntilDate(DateSelectEvent event) {
		untilDate = event.getDate();
		if (fromDate != null) {
			if (fromDate.after(untilDate)) {
				untilDate = null;
				FacesContext.getCurrentInstance().addMessage(
						null,
						new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error!",
								"Beginning date bigger that end date!"));
			}
		}
	}

	// Getters and setters
	public ProjectEntity getSelectedProject() {

		return selectedProject;
	}

	public void setSelectedProject(ProjectEntity selectedProject) {

		this.selectedProject = selectedProject;
	}

	public List<ProjectEntity> getProjects() {
		return projects;
	}

	public void setProjects(List<ProjectEntity> projects) {
		this.projects = projects;
	}

	public ReportServices getReportServices() {
		return reportServices;
	}

	public void setReportServices(ReportServices reportServices) {
		this.reportServices = reportServices;
	}

	public List<ProjectEntity> getFilteredProjectList() {
		return filteredProjectList;
	}

	public void setFilteredProjectList(List<ProjectEntity> filteredProjectList) {
		this.filteredProjectList = filteredProjectList;
	}

	public List<ScenarioEntity> getScenarios() {
		return scenarios;
	}

	public void setScenarios(List<ScenarioEntity> scenarios) {

		this.scenarios = scenarios;
	}

	public ScenarioEntity getSelectedScenario() {
		return selectedScenario;
	}

	public void setSelectedScenario(ScenarioEntity selectedScenario) {
		this.selectedScenario = selectedScenario;
	}

	public List<ScenarioEntity> getFilteredScenarioList() {
		return filteredScenarioList;
	}

	public void setFilteredScenarioList(
			List<ScenarioEntity> filteredScenarioList) {
		this.filteredScenarioList = filteredScenarioList;
	}

	public ScenarioTypeEntity[] getSelectedScenarioType() {
		return selectedScenarioType;
	}

	public void setSelectedScenarioType(
			ScenarioTypeEntity[] selectedScenarioType) {

		this.selectedScenarioType = selectedScenarioType;
	}

	public List<ScenarioTypeEntity> getScenarioTypes() {
		return scenarioTypes;
	}

	public void setScenarioTypes(List<ScenarioTypeEntity> scenarioTypes) {
		this.scenarioTypes = scenarioTypes;
	}

	public List<ScenarioTypeEntity> getFilteredScenarioTypeList() {
		return filteredScenarioTypeList;
	}

	public void setFilteredScenarioTypeList(
			List<ScenarioTypeEntity> filteredScenarioTypeList) {
		this.filteredScenarioTypeList = filteredScenarioTypeList;
	}

	public ReportEntity getReportEntity() {
		return reportEntity;
	}

	public void setReportEntity(ReportEntity reportEntity) {
		this.reportEntity = reportEntity;
	}

	public String[] getSelectedBranchID() {
		return selectedBranchID;
	}

	public void setSelectedBranchID(String[] selectedBranchID) {
		this.selectedBranchID = selectedBranchID;
	}

	public List<String> getBranchId() {
		return branchId;
	}

	public void setBranchId(List<String> branchId) {
		this.branchId = branchId;
	}

	public List<String> getFilteredBranchId() {
		return filteredBranchId;
	}

	public void setFilteredBranchId(List<String> filteredBranchId) {
		this.filteredBranchId = filteredBranchId;
	}

	public List<String> getBuildId() {
		return buildId;
	}

	public void setBuildId(List<String> buildId) {
		this.buildId = buildId;
	}

	public TransactionEntity[] getSelectedTransaction() {
		return selectedTransaction;
	}

	public void setSelectedTransaction(TransactionEntity[] selectedTransaction) {
		this.selectedTransaction = selectedTransaction;
	}

	public List<String> getFilteredBuildId() {
		return filteredBuildId;
	}

	public void setFilteredBuildId(List<String> filteredBuildId) {
		this.filteredBuildId = filteredBuildId;
	}

	public List<String> getState() {
		return state;
	}

	public List<String> getFilteredState() {
		return filteredState;
	}

	public void setFilteredState(List<String> filteredState) {
		this.filteredState = filteredState;
	}

	public void setState(List<String> state) {
		this.state = state;
	}

	public String[] getSelectedBuildID() {
		return selectedBuildID;
	}

	public void setSelectedBuildID(String[] selectedBuildID) {
		this.selectedBuildID = selectedBuildID;
	}

	public String[] getSelectedState() {
		return selectedState;
	}

	public void setSelectedState(String[] selectedState) {
		this.selectedState = selectedState;
	}

	public Date getFromDate() {
		return fromDate;
	}

	public void setFromDate(Date fromDate) {
		this.fromDate = fromDate;
	}

	public Date getUntilDate() {
		return untilDate;
	}

	public List<String> getReportType() {
		return reportType;
	}

	public void setReportType(List<String> reportType) {
		this.reportType = reportType;
	}

	public String getSelectedReportType() {
		return selectedReportType;
	}

	public void setSelectedReportType(String selectedReportType) {
		this.selectedReportType = selectedReportType;
	}

	public List<String> getReportSubType() {
		return reportSubType;
	}

	public void setReportSubType(List<String> reportSubType) {
		this.reportSubType = reportSubType;
	}

	public String getSelectedReportSubType() {
		return selectedReportSubType;
	}

	public void setSelectedReportSubType(String selectedReportSubType) {
		this.selectedReportSubType = selectedReportSubType;
	}

	public void setUntilDate(Date untilDate) {
		this.untilDate = untilDate;
	}

	public StreamedContent getReport() {
		return report;
	}

	public void setReport(StreamedContent report) {
		this.report = report;
	}

	public List<String> getReportFormat() {
		return reportFormat;
	}

	public void setReportFormat(List<String> reportFormat) {
		this.reportFormat = reportFormat;
	}

	public String getSelectedReportFormat() {
		return selectedReportFormat;
	}

	public void setSelectedReportFormat(String selectedReportFormat) {
		this.selectedReportFormat = selectedReportFormat;
	}

	public List<TransactionEntity> getTransactions() {
		return transactions;
	}

	public void setTransactions(List<TransactionEntity> transactions) {
		this.transactions = transactions;
	}

	public List<TransactionEntity> getFilteredTransactions() {
		return filteredTransactions;
	}

	public void setFilteredTransactions(
			List<TransactionEntity> filteredTransactions) {
		this.filteredTransactions = filteredTransactions;
	}

	public TestSummaryEntity[] getSelectedTestSummary() {
		return selectedTestSummary;
	}

	public void setSelectedTestSummary(TestSummaryEntity[] selectedTestSummary) {
		this.selectedTestSummary = selectedTestSummary;
	}

	public List<TestSummaryEntity> getTestSummaries() {
		return testSummaries;
	}

	public void setTestSummaries(List<TestSummaryEntity> testSummaries) {
		this.testSummaries = testSummaries;
	}

	public String getTemplateName() {
		return templateName;
	}

	public void setTemplateName(String templateName) {
		this.templateName = templateName;
	}

	public Integer getRowNumber() {
		return rowNumber;
	}

	public void setRowNumber(Integer rowNumber) {
		this.rowNumber = rowNumber;
	}

}
